Magnetic disk controller and method

ABSTRACT

Among other disclosed subject matter, a magnetic disk controller can include an index detecting unit to detect an index of the magnetic disk, an error check code generating unit to, after the index detecting unit detects the index, generate a first error check code for first write data based on the first write data and a first physical address of a first sector subsequent to the detected index, and a writing control unit to cause the first error check code generated by the error check code generating unit, the first write data and the first physical address to be written into a second sector subsequent to the first sector.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority from Japanese patent application serialnumber 2007-023005, filed Feb. 1, 2007, and Provisional Application No.60/889,174 filed Feb. 9, 2007, the entire contents of which areincorporated herein by reference.

TECHNICAL FIELD

The present invention relates to information storage.

BACKGROUND ART

A magnetic disk controller which, when reading data corresponding toeach sector from a magnetic disk apparatus, transfers ID informationregarding the sector before transferring the data of the sector has beenproposed as, for example, in Japanese Patent Application publication No.7-141113.

When writing data from a host into a magnetic disk, a magnetic diskcontroller obtains the address of a sector to which the data is to bewritten, and calculates an error check code based on the obtainedaddress and the data to be written into the sector. Hence, the magneticdisk controller can not write the data and error check code into thesector immediately after obtaining the address of the sector.Accordingly, the magnetic disk controller keeps on hold the writing ofthe data and error check code until the sector comes back to theposition of the magnetic head, which delays the writing of the data anderror check code.

SUMMARY

The invention relates to information storage.

In a first aspect, a magnetic disk controller includes an indexdetecting unit that detects an index of a magnetic disk. The magneticdisk controller includes an error check code generating unit that, afterthe index detecting unit detects the index, generates a first errorcheck code for a first write data based on the first write data and on afirst physical address of a first sector subsequent to the detectedindex. The magnetic disk controller includes a writing control unit thatcauses the first error check code generated by the error check codegenerating unit, the first write data and the first physical address tobe written into a second sector subsequent to the first sector.

Implementations can include any, all or none of the following features.The first sector can be adjacent to the detected index, and the secondsector can be adjacent to the first sector on a side opposite from thedetected index. The magnetic disk controller can include an addressgenerating unit that sequentially generates a physical address of asector in accordance with an elapsed time from when the index detectingunit detects the index, wherein the first physical address of the firstsector is generated by the address generating unit. The error check codegenerating unit can further generate a second error check code forsecond write data based on the second write data and on a secondphysical address of the second sector which is generated by the addressgenerating unit, and the writing control unit can further cause thesecond error check code generated by the error check code generatingunit, the second write data and the second physical address to bewritten into a third sector subsequent to the second sector. The thirdsector can be adjacent to the second sector on a side opposite from thefirst sector. The magnetic disk controller can include an addressobtaining unit to obtain a physical address representing a sector onwhich read data is stored; an address adding unit to add a predeterminedvalue to the physical address obtained by the address obtaining unit;and a reading control unit to cause data to be read from a sectorrepresented by a physical address generated as a result of the additionperformed by the address adding unit. The predetermined value can beone.

In a second aspect, a method of controlling writing of data into amagnetic disk includes detecting an index of a magnetic disk. The methodincludes generating, after the index is detected, a first error checkcode for first write data based on first write data and on a firstphysical address of a first sector subsequent to the detected index. Themethod includes causing the generated first error check code, the firstwrite data and the first physical address to be written into a secondsector subsequent to the first sector.

Implementations can include any, all or none of the following features.The first sector can be adjacent to the detected index, and the secondsector can be adjacent to the first sector on a side opposite from thedetected index. The method can include sequentially generating the firstphysical address of the first sector in accordance with an elapsed timefrom when the index is detected. The method can include generating asecond physical address of the second sector; generating a second errorcheck code for second write data based on the second write data and onthe second physical address of the second sector, and causing the seconderror check code, the second write data and the second physical addressto be written into a third sector subsequent to the second sector. Thethird sector can be adjacent to the second sector on a side oppositefrom the first sector. The method can further include obtaining aphysical address representing a sector on which read data is stored;adding a predetermined value to the obtained physical address to form anew physical address; and causing data to be read from a sectorrepresented by the new physical address. The predetermined value can beone.

In a third aspect, a magnetic disk controller includes means fordetecting an index of a magnetic disk. The magnetic disk controllerincludes means for generating, after the index is detected, a firsterror check code for first write data based on the first write data andon a first physical address of a first sector subsequent to the detectedindex. The magnetic disk controller includes means for causing thegenerated first error check code, the first write data and the firstphysical address to be written into a second sector subsequent to thefirst sector.

In a fourth aspect, a method includes determining a first physicaladdress of a magnetic disk to which first data is to be written. Themethod includes generating a first error check code based on the firstdata and the first physical address. The method includes writing thefirst physical address, the first error check code and the first data tothe magnetic disk substantially immediately after generating the firsterror check code.

Implementations can include any, all or none of the following features.The writing being performed substantially immediately can include thatthe writing is not kept on hold until a head of the magnetic diskreturns to a previous position on the magnetic disk. The previousposition can be where the head was located when the first error checkcode was generated. The first physical address can be associated with afirst sector on the magnetic disk, and the first physical address, thefirst error check code and the first data can be written to a secondsector on the magnetic disk associated with a second physical address.The method can include obtaining the first physical address as alocation for reading the first data; converting the first physicaladdress to the second physical address; and reading the first data fromthe second sector using the second physical address. The conversion caninclude adding a predetermined value to the first physical address.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a functional configuration of amagnetic disk controller 10.

FIG. 2 shows writing of data into a magnetic disk 20.

FIG. 3 is a block diagram showing a functional configuration of anencoding unit 150.

FIG. 4 is a block diagram showing a functional configuration of a bufferunit 140.

FIG. 5 shows writing of data into the magnetic disk 20.

FIG. 6 shows writing of data into the magnetic disk 20.

FIG. 7 is a block diagram showing a functional configuration of thebuffer unit 140.

FIG. 8 shows writing of data into the magnetic disk 20.

FIG. 9 shows writing of data into the magnetic disk 20.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

Hereinafter, some embodiments will be described. The embodiments do notlimit the scope of the invention according to the claims, and all thecombinations of the features described in the embodiments are notnecessarily essential.

FIG. 1 presents an example of an example functional configuration of amagnetic disk controller 10. The magnetic disk controller 10 herereceives data from a host 40, and writes the data into a magnetic disk20. In other words, the magnetic disk controller 10 controls writing ofdata performed via a head 30 into the magnetic disk 20. The host 40 canbe a host computer, and can execute a predetermined command and datatransmission/reception, for example by accessing a register group of amagnetic disk apparatus including therein the magnetic disk 20. Theregister group may include a control block register group and a commandblock register group.

An advantage of the magnetic disk controller 10 relating to the presentembodiment is to write data and an error check code into a magnetic disksubstantially immediately after generating the error check code based onthe data.

The magnetic disk controller 10 in this example includes therein areading control unit 100, an index detecting unit 105, a timing controlunit 107, a writing control unit 110, a decoding unit 120, an addressobtaining unit 125, an address adding unit 127, an address generatingunit 130, a buffer control unit 135, a buffer unit 140, an error checkcode generating unit 145, an encoding unit 150, an interface 160, and anencoding method determining unit 165. It should be noted here that themagnetic disk 20 is a hard disk, for example.

The interface 160 transfers data to or from the magnetic disk 20.Specifically speaking, the interface 160 in some implementationsreceives, from the host 40, the data to be written into the magneticdisk 20, and transfers the data to the buffer control unit 135 andencoding method determining unit 165. Also, the interface 160 in someimplementations receives data from the decoding unit 120, and transfersthe data to the host 40. The index detecting unit 105 in someimplementations detects, via the head 30, the index of the magnetic disk20. The index detecting unit 105 in some implementations provides asignal representing a timing of the detection of the index to theaddress obtaining unit 125 and timing control unit 107.

In some implementations, the address generating unit 130 sequentiallygenerates a physical address of a sector in accordance with a timeperiod from the detection of the index by the index detecting unit 105.To be specific, the address generating unit 130 can receive, via theaddress obtaining unit 125, the signal representing the timing of thedetection of the index from the index detecting unit 105, andsequentially generate a physical address of a sector in synchronizationwith the rotation of the magnetic disk 20. The address generating unit130 can sequentially provide the generated physical address to the errorcheck code generating unit 145. The address obtaining unit 125 canobtain a physical address on which reading data is stored. The addressobtaining unit 125 can provide the obtained physical address to theaddress adding unit 127 and error check code generating unit 145. Theaddress obtaining unit 125 can provide the signal representing thetiming of the detection of the index, which can be received from theindex detecting unit 105, to the address generating unit 130.

In some implementations, the error check code generating unit 145generates a plurality of error check codes respectively for detectingerrors of a plurality of pieces of write data. Specifically speaking,the error check code generating unit 145 can generate, after the indexdetecting unit 105 detects the index, a first error check code (CRCcode) for first write data based on the first write data and a firstphysical address of a first sector subsequent to the detected index.Here, the error check code generating unit 145 may generate an errorcheck code based on encoded data created by the encoding unit 150. Theerror check code generating unit 145 may generate, after the indexdetecting unit 105 detects the index, a first error correction code (ECCcode) for the first write data based on the first write data and thefirst physical address of the first sector subsequent to the detectedindex.

The error check code generating unit 145 may generate the first errorcheck code for the first write data based on the first write data andthe first physical address of the first sector which is adjacent to thedetected index. The error check code generating unit 145 may generatethe first error check code for the first write data based on the firstwrite data and the first physical address of the first sector which isgenerated by the address generating unit 130 in synchronization with therotation of the magnetic disk 20. In addition, the error check codegenerating unit 145 can further generate a second error check code forsecond write data based on the second write data and a second physicaladdress of a second sector which is generated by the address generatingunit 130. The error check code generating unit 145 can provide agenerated error check code and/or a generated error correction code tothe buffer control unit 135.

In some implementations, the timing control unit 107 controls the timingat which the writing control unit 110 writes data into the magnetic disk20, in accordance with the timing at which the index detecting unit 105detects the index. The writing control unit 110 can write the datareceived from the buffer control unit 135 into the magnetic disk 20 viathe head 30, at the timing controlled by the timing control unit 107. Tobe specific, the writing control unit 110 can control the head 30 so asto write the first error check code generated by the error check codegenerating unit 145, the first write data and the first physical addressinto a second sector subsequent to the first sector.

In some implementations, the writing control unit 110 causes the firsterror check code generated by the error check code generating unit 145,the first write data and the first physical address to be written intothe second sector which is adjacent to the first sector on a sideopposite from the index detected by the index detecting unit 105. Thewriting control unit 110 can cause the second error check code generatedby the error check code generating unit 145, the second write data andthe second physical address to be written into a third sector subsequentto the second sector. The writing control unit 110 can cause the seconderror check code generated by the error check code generating unit 145,the second write data and the second physical address to be written intothe third sector which is adjacent to the second sector on a sideopposite from the first sector.

In some implementations, the address adding unit 127 adds apredetermined value to the physical address obtained by the addressobtaining unit 125. For example, the address adding unit 127 can add “1”to the physical address obtained by the address obtaining unit 125. Whenthe error check code generating unit 145 requires a longer time periodthan a predetermined time period to generate an error correction codeand/or an error check code, the address adding unit 127 may add aninteger other than “1” (for example, integers larger than “1”, such as“2” and/or “3”) to the physical address obtained by the addressobtaining unit 125. The address adding unit 127 can provide the resultof the addition to the reading control unit 100. The reading controlunit 100 can cause data to be read from a sector corresponding to thephysical address generated by the address adding unit 127. The readingcontrol unit 100 can provide the read data to the decoding unit 120. Inother implementations, the address adding unit 127 can convert thephysical address in another way, such as by subtraction, multiplicationor division, or any other conversion operation.

In some implementations, the buffer unit 140 includes therein at leastone buffer for temporarily storing data to be written into the magneticdisk 20. The buffer unit 140 can be controlled by the buffer controlunit 135 so as to cause the at least one buffer to store temporarily thedata to be written into the magnetic disk 20. The buffer unit 140 canprovide the data stored on the buffer to the buffer control unit 135.

In some implementations, the buffer control unit 135 controlsstoring/reading data onto/from the buffer included in the buffer unit140. The buffer control unit 135 can provide the data received from thebuffer unit 140 to the encoding unit 150, and can cause the encoded datafrom the encoding unit 150 to be stored onto the buffer included in thebuffer unit 140. The buffer control unit 135 can store the error checkcode generated by the error check code generating unit 145 onto thebuffer included in the buffer unit 140. The buffer control unit 135 canread the data stored on the buffer included in the buffer unit 140, andcan provide the read data to the writing control unit 110.

In some implementations, the encoding method determining unit 165receives data to be written into the magnetic disk 20 from the interface160, and determines an encoding method based on the received data. Insome implementations, the encoding method determining unit 165 maytransfer, to the encoding unit 150, the encoding method designated inadvance by the user, independently from the data. The encoding methoddetermining unit 165 can determine encoding methods to be used by theencoding unit 150 to encode a plurality of pieces of write data to bewritten into a plurality of sectors included in the magnetic disk 20,for example in such a manner that the encoding methods correspond to thepieces of write data in a one-to-one correspondence. In someimplementations, the encoding method determining unit 165 can determinean appropriate encoding method by varying one or more of the factorsincluding a minimum magnetization reversal interval, a maximummagnetization reversal interval, a bit length of original data and a bitlength of encoded data, to name a few examples. For example, theencoding method determining unit 165 may choose an encoding method withthe use of RLL codes. The encoding method determining unit 165 canprovide information representing the determined encoding methods to theencoding unit 150.

In some implementations, the encoding unit 150 sequentially encodes theplurality of pieces of write data to be written into the plurality ofsectors included in the magnetic disk 20 to create a plurality of piecesof data each representing a signal to be applied to the magnetic disk20. For example, the encoding unit 150 can use the encoding methoddetermined by the encoding method determining unit 165 in order toencode and thus convert the data (original data) received from thebuffer control unit 135 into a different sequence of data that has alower error rate than the original data. The encoding unit 150 canprovide the encoded data to the buffer control unit 135 and error checkcode generating unit 145. The decoding unit 120 can decode the encodeddata stored on the magnetic disk 20, which is received from the readingcontrol unit 100, into the original data, and can provide the decodeddata to the interface 160. In this example, the data width is M betweenthe encoding unit 150 and buffer control unit 135, and the data width isN between the interface 160 and the buffer control unit 135, where thedata width M may be equal to or larger than twice the data width N. Inother implementations one or more other widths may be used.

The writing control unit 110 can write the error check code generated bythe error check code generating unit 145 into the second sectorsubsequent to the first sector. In some implementations, this means thatthe error check code for the first sector is not stored on the firstsector. The magnetic disk controller 10 may not need to hold the writingof the error check code for the first sector until the magnetic disk 20rotates so that the first sector comes back to the head 30. As aconsequence, the present embodiment can reduce a time period from whenwrite data is obtained to when the error check code is written into themagnetic disk 20.

FIG. 2 shows, as an example, writing of data into the magnetic disk 20that can be performed by the magnetic disk controller 10. The magneticdisk controller 10 can store the first error check code for the firstwrite data, which can be generated based on the first write data and thefirst physical address (e.g. physical address “0”) of the first sector(e.g. the sector 214 associated with the physical address “0”)subsequent to the index 200 detected by the index detecting unit 105,onto the sector 216 associated with the physical address “1” whichfollows the first sector. The magnetic disk controller 10 can write thefirst physical address and the first write data of the first sector 214onto the sector 216 following the first sector 214.

In some implementations, the magnetic disk controller 10 may write thefirst error check code, first write data and first physical address, notinto the sector 216 which immediately follows the first sector (e.g.sector 214), but into a sector (e.g. sector 220) which follows thesector 214 with a predetermined number of sectors therebetween. In thesame manner, the magnetic disk controller 10 stores data in terms of thesectors 210, 212, 216, 218 and 220.

FIG. 3 shows an example of a functional configuration of the encodingunit 150. The encoding unit 150 here includes therein a reading cache152, an encoding core unit 154 and a writing cache 156. The readingcache 152 can read the data stored on the buffer included in the bufferunit 140, for example in units of the data width M via the buffercontrol unit 135. The reading cache 152 can then divide the read datahaving the data width M into pieces of data each having a data widthsmaller than the data width M, and can output the pieces of data to theencoding core unit 154.

In some implementations, the encoding core unit 154 encodes the data.The encoding core unit 154 can encode the data received from the readingcache 152 by using the encoding method determined by the encoding methoddetermining unit 165. The encoding core unit 154 can provide the encodeddata to the writing cache 156. The writing cache 156 can combine piecesof data which are received one at a time from the encoding core unit154, and then write the data into the buffer included in the buffer unit140 in units of the data width M. In some implementations, the writingcache 156 provides the data received from the encoding core unit 154 tothe error check code generating unit 145.

FIG. 4 shows an example of a functional configuration of the buffer unit140. The buffer unit 140 here includes therein a first buffer 141, asecond buffer 142 and a third buffer 143. One or more of the first,second and third buffers 141, 142 and 143 can be controlled by thebuffer control unit 135 so as to store data thereon. As another example,the first, second and third buffers 141, 142 and 143 can be controlledby the buffer control unit 135 so as to provide data to the buffercontrol unit 135. One or more of the first, second and third buffers141, 142 and 143 can temporarily store thereon data to be written intoat least one sector of the magnetic disk 20, where the data can bereceived from the interface 160. As another example, one or more of thefirst, second and third buffers 141, 142 and 143 can temporarily storeencoded data corresponding to at least one sector.

For example, the first buffer 141 can store thereon the first write datawhich has been encoded by the encoding unit 150 and is to be writteninto the first sector of the magnetic disk 20, and the first error checkcode for the first write data which is generated by the error check codegenerating unit 145. More specifically, the first buffer 141 can storethe first error check code onto successive storage areas, after storingthe first write data which has been encoded by the encoding unit 150onto successive storage areas.

In some implementations, the second buffer 142 stores thereon the secondwrite data which has been encoded by the encoding unit 150 and is to bewritten into the second sector of the magnetic disk 20, and the seconderror check code for the second write data which is generated by theerror check code generating unit 145. For example, the second buffer 142can store thereon the second write data and second error check codewhich are to be written into the second sector subsequent to the firstsector of the magnetic disk 20. For example, the second buffer 142 canstore thereon the second write data and second error check code whichare to be written into the second sector which is adjacent andsubsequent to the first sector of the magnetic disk.

In some implementations, the third buffer 143 stores thereon the thirdwrite data which has been encoded by the encoding unit 150 and is to bewritten into the third sector of the magnetic disk 20, and the thirderror check code for the third write data which is generated by theerror check code generating unit 145. For example, the third buffer 143can store thereon the third write data and third error check code whichare to be written into the third sector subsequent to the second sectorof the magnetic disk 20. For example, the third buffer 143 can storethereon the third write data and third error check code which are to bewritten into the third sector which is adjacent and subsequent to thesecond sector of the magnetic disk 20.

When the buffer unit 140 is configured in the above-described manner insome implementations, the buffer control unit 135 controls, in a firstperiod, the first write data and first error check code stored on thefirst buffer 141 to be written into the first sector of the magneticdisk 20, concurrently with controlling the second write data which hasbeen encoded by the encoding unit 150 and the second error check codegenerated by the error check code generating unit 145 to be stored ontothe second buffer 142. Here, the buffer control unit 135 may read andoutput, one at a time and alternately, portions of the first write datastored on the first buffer 141 and portions of the first error checkcode stored on the first buffer 141. The buffer control unit 135 cancause the output first write data and first error check code to bewritten into the first sector of the magnetic disk 20. The first errorcheck code generated by the error check code generating unit 145 can, insome implementations, be stored on the first buffer 141 and written intothe first sector of the magnetic disk 20 without being encoded.

In some implementations, when outputting the first error check code andfirst write data, the buffer control unit 135 may sequentially insert apredetermined amount of the first error check code into the first writedata at predetermined intervals. For example, assume that the firstwrite data has a data amount of 512 bytes. The buffer control unit 135can partition the first error check code in units of 5 to 11 into piecesof data, for example, and can insert the pieces of data into the firstwrite data when outputting the first write data and first error checkcode. If the first write data has a data amount of 1,024 bytes, thebuffer control unit 135 in some implementations partitions the firsterror check code in units of 8 to 22 into pieces of data, for example,and can insert the pieces of data into the first write data whenoutputting the first write data and first error check code. In someimplementations if the first write data has a data amount of 4,096bytes, the buffer control unit 135 partitions the first error check codein units of 8 to 20 into pieces of data, for example, and can insert thepieces of data into the first write data when outputting the first writedata and first error check code. In other implementations, one or moreother numbers of units and/or other data amount(s) can be used.

In some implementations, the buffer control unit 135 controls, in thefirst period, the first write data and first error check code stored onthe first buffer 141 to be written into the first sector of the magneticdisk, and controls the second write data which has been encoded by theencoding unit 150 and the second error check code generated by the errorcheck code generating unit 145 to be stored onto the second buffer 142,concurrently with controlling the third write data which has not beenencoded by the encoding unit 150 to be written into the third buffer143. In a second period following the first period, the buffer controlunit 135 can control the second write data and second error check codestored on the second buffer 142 to be written into the second sector ofthe magnetic disk 20, concurrently with controlling the third write datawhich has been encoded by the encoding unit 150 and the third errorcheck code generated by the error check code generating unit 145 to bestored onto the third buffer 143, to replace the third write data whichhas not been encoded by the encoding unit 150.

In some implementations, concurrently with the buffer control unit 135controlling the third write data which has not been encoded by theencoding unit 150 to be stored onto the third buffer 143, the encodingmethod determining unit 165 can receive the third write data anddetermine the encoding method to be used by the encoding unit 150 toencode the third write data. The encoding method determining unit 165can determine the encoding method to be one of, for example, RZ method,RB method, NRZ method, PM method, PE method, FM method and the like. Theencoding unit 150 can encode the data stored on the first and secondbuffers 141 and 142 into encoded data representing signals to be appliedto the magnetic disk 20.

In the above-described case, while writing the data received from theinterface 160 into at least one of the first and second buffers 141 and142, the buffer control unit 135 can read data from the other buffer.Following this, in some implementations, the buffer control unit 135uses the encoding unit 150 to encode the read data, and stores theencoded data into the other buffer. For example, the data width Mbetween the encoding unit 150 and the first and second buffers 141 and142 may be equal to or larger than twice the data width N between theinterface 160 and the first and second buffers 141 and 142.

In some implementations, the reading cache 152 in the encoding unit 150reads the data from the first and second buffers 141 and 142 in units ofthe data width M. The reading cache 152 can then divide the read datainto pieces of data having a smaller data width than the data width M,and can output the pieces of data to the encoding core unit 154.Subsequently, the writing cache 156 can combine pieces of data which arerespectively received on separate occasions from the encoding core unit154. The writing cache 156 can then write the combined pieces of data inunits of the data width M onto one of the first and second buffers 141and 142.

In some implementations, the magnetic disk controller 10 is designed sothat the sum of the data reading cycle from the first and second buffers141 and 142 to the encoding unit 150 and the data writing cycle from theencoding unit 150 to the first and second buffers 141 and 142 issubstantially equal to the data writing cycle from the interface 160 tothe first and second buffers 141 and 142.

In some implementations, the writing control unit 110 reads the encodeddata from the third buffer 143 and writes the read encoded data into themagnetic disk 20. For example, the magnetic disk controller 10 can bedesigned so that the sum of the data reading cycle from the first andsecond buffers 141 and 142 to the encoding unit 150 and the data writingcycle from the encoding unit 150 to the first and second buffers 141 and142 is substantially equal to the data reading cycle from the thirdbuffer 143 to the writing control unit 110.

In some implementations, the buffer control unit 135 controls the firstbuffer 141 to function in the same manner as the second buffer 142,controls the second buffer 142 to function in the same manner as thethird buffer 143, and controls the third buffer 143 to function in thesame manner as the first buffer 141. In this way, the buffer controlunit 135 can use the first, second and third buffers 141, 142 and 143 inrotation in some implementations.

FIG. 5 shows, as an example, writing of data into the magnetic disk 20performed by, for example, the magnetic disk controller 10. To beginwith, data (e.g. data A) can be stored onto the first buffer 141 in aphase 600 (S100). Subsequently, data (e.g. data B) can be stored ontothe second buffer 142 in a phase 602 (S105). In synchronization with thetiming at which the data is stored onto the second buffer 142, the datastored on the first buffer 141 can be encoded by the encoding unit 150,and then stored back onto the first buffer 141 (S110). Also, an errorcheck code and/or error correction code can be generated by the errorcheck code generating unit 145 for the data stored on the first buffer141, and can be stored onto the first buffer 141 together with theencoded data (S110).

In a phase 604 following the phase 602, the error check code and/orerror correction code stored on the first buffer 141 can be stored ontothe magnetic disk 20 together with the data, in a state of beingpartitioned and inserted at predetermined intervals (S115). Meanwhile,data (e.g. data C) can be stored onto the third buffer 143 (S120). Insynchronization with the timing at which the data is stored onto thethird buffer 143, the data stored on the second buffer 142 can beencoded by the encoding unit 150, and stored back onto the second buffer142 (S125). As another example, an error check code and/or errorcorrection code can be generated by the error check code generating unit145 for the data stored on the second buffer 142, and can be stored ontothe second buffer 142 (S125).

FIG. 6 shows, as an example, writing of data into the magnetic disk 20performed by, for example, the magnetic disk controller 10. To beginwith, the buffer control unit 135, in some implementations, controlsdata (e.g. data A) to be stored onto the first buffer 141 in the phase600 (S200). In the following phase 602, the data A stored on the firstbuffer 141 can be encoded by the encoding unit 150. The buffer controlunit 135 can control the encoded data A′ created by the encoding unit150 to be stored onto the first buffer 141 (S205). In synchronizationwith the timing of storing the encoded data A′ onto the first buffer141, the buffer control unit 135 can control data (e.g. data B) to bestored onto the second buffer 142 (S210).

In the phase 604, the buffer control unit 135, in some implementations,controls the encoded data A′ stored on the first buffer 141 to bewritten into the magnetic disk 20 (S215). As another example, the data Bstored on the second buffer 142 can be encoded by the encoding unit 150.The buffer control unit 135 can control the encoded data B′ created bythe encoding unit 150 to be stored onto the second buffer 142 (S220). Insynchronization with the timing of storing the encoded data B′ onto thesecond buffer 142, the buffer control unit 135, in some implementationscontrols data (e.g. data C) to be stored onto the third buffer 143(S230).

FIG. 7 shows an example of a functional configuration of the buffer unit140. The buffer unit 140 here includes therein the first, second andthird buffers 141, 142 and 143. The first buffer 141 here includestherein a first storage area 144 and a second storage area 146.

In some implementations, the first buffer 141 includes therein the firststorage area 144 for sequentially storing former half data, out offormer half data and latter half data constituting each of a pluralityof pieces of write data to be written into the plurality of sectors ofthe magnetic disk 20. As another example, the first buffer 141 includestherein the second storage area 146 for sequentially storing the latterhalf data included in each of the plurality of pieces of write data. Insome implementations, as long as the sum of the data amount of theformer half data and the data amount of the latter half data is equal tothe data amount of data to be written into each sector, the data amountof the former half data and the data amount of the latter half data maybe designed different from each other.

In some implementations, the first buffer 141 stores former half datareceived from the buffer control unit 135 onto the first storage area144. After this, the first buffer 141 can store latter half datareceived from the buffer control unit 135 onto the second storage area146. Concurrently with the latter half data of the first write data tobe written into the first sector of the magnetic disk 20 is being storedonto the second storage area 146, the encoding unit 150 can receive,from the buffer control unit 135, the former half data of the firstwrite data, which may have been stored on the first storage area 144.Subsequently, the encoding unit 150 can encode the received former halfdata into data representing a signal to be applied to the magnetic disk20.

In some implementations the second buffer 142 receives the former halfdata of the first write data, which has been encoded by the encodingunit 150, from the buffer control unit 135 and stores the former halfdata thereon. After storing thereon the former half data and latter halfdata of the first write data which have been encoded by the encodingunit 150, the second buffer 142 can receive the first error check codefor the first write data, which is generated by the error check codegenerating unit 145, from the buffer control unit 135, and can storethereon the first error check code. For example, after receiving thefirst write data including the former half data and latter half datawhich have been encoded by the encoding unit 150 from the buffer controlunit 135 and storing the first write data onto successive storage areas,the second buffer 142 can store the first error check code ontosuccessive storage areas.

In some implementations, the buffer control unit 135 controls the formerhalf data of the first write data which is stored on the second buffer142 to be written into the first sector of the magnetic disk 20. Forexample, concurrently with the former half data of the second write datato be written into the second sector of the magnetic disk 20 beingstored onto the first storage area 144, the encoding unit 150 canreceive the latter half data of the first write data, which has beenstored on the second storage area 146, from the buffer control unit 135,and encodes the latter half data. After storing thereon the former halfdata of the first write data, the second buffer 142 stores thereon thelatter half data of the first write data which has been encoded by theencoding unit 150.

Following this, after controlling the former half data of the firstwrite data to be written into the magnetic disk 20, the buffer controlunit 135, in some implementations, controls the latter half data of thefirst write data, which is stored on the second buffer 142, to bewritten into the first sector of the magnetic disk 20. For example,along with the former half data and latter half data of the first writedata, the buffer control unit 135 can controls the first error checkcode which is stored on the second buffer 142 to be written into thefirst sector of the magnetic disk 20. For example, the buffer controlunit 135 can read and output, one at a time and alternately, portions ofthe first write data and first error check code which are stored on thesecond buffer 142. Then, the buffer control unit 135 controls the outputfirst write data and first error check code to be written into the firstsector of the magnetic disk 20.

In this case, the first error check code generated by the error checkcode generating unit 145 may in some implementations be stored onto thesecond buffer 142 and written into the first sector of the magnetic disk20 without being encoded. When outputting the first error check code andfirst write data, the buffer control unit 135 may insert a predetermineddata amount of the first error check code into the first write data atpredetermined intervals.

Concurrently with the latter half data of the second write data beingstored onto the second storage area 146, the encoding unit 150 canreceive the former half data of the second write data which has beenstored on the first storage area 144 from the buffer control unit 135and encodes the former half data. After this, concurrently with theformer half data of the third write data to be written onto the thirdsector of the magnetic disk 20 being stored onto the first storage area144, the encoding unit 150 can encode the latter half data of the secondwrite data which has been stored on the second storage area 146.

After receiving the former half data of the second write data which hasbeen encoded by the encoding unit 150 from the buffer control unit 135and storing the former half data, the third buffer 143 in someimplementations receives the latter half data of the second write datawhich has been encoded by the encoding unit 150 from the buffer controlunit 135 and stores the latter half data. Subsequently, aftercontrolling the first write data which is stored on the second buffer142 to be written into the first sector, the buffer control unit 135 cancontrol the second write data which is stored on the third buffer 143 tobe written into the second sector.

The encoding method determining unit 165 in some implementationsdetermines encoding methods to be used by the encoding unit 150 toencode the plurality of pieces of write data to be written into theplurality of sectors of the magnetic disk 20, for example, so that eachof the encoding methods corresponds to the former half data or latterhalf data of a corresponding one of the plurality of pieces of writedata. For example, concurrently with the former half data of the firstwrite data being stored onto the first storage area 144, the encodingmethod determining unit 165 can receive the former half data of thefirst write data, and determine the encoding method to be used by theencoding unit 150 to encode the former half data of the first writedata. As another example, concurrently with that the latter half data ofthe first write data is being stored onto the second storage area 146,the encoding method determining unit 165 can receive the latter halfdata of the first write data, and can determine the encoding method tobe used by the encoding unit 150 to encode the latter half data of thefirst write data.

FIG. 8 shows, as an example, writing of data into the magnetic disk 20that can be performed by, for example, the magnetic disk controller 10.To begin with, in a phase 900, the buffer control unit 135 can storeformer half data (e.g. data A-1) onto the first storage area 144 (S300).In the following phase 910, the buffer control unit 135 can control thedata A-1 which is stored on the first storage area 144 to be encoded bythe encoding unit 150, and can control the encoded data A-1 to be storedonto the second buffer 142 (S305 and S310). For example, the buffercontrol unit 135 can control the encoded data A-1 to be provided fromthe encoding unit 150 to the error check code generating unit 145.

In some implementations, in the phase 910, the buffer control unit 135controls latter half data (e.g. data A-2, where the data A-1 and dataA-2 together form one piece of data A) to be stored onto the secondstorage area 146 (S315). At a timing 800 between the phase 910 and aphase 920, the buffer control unit 135 can control the data A-2 which isstored on the second storage area 146 to be encoded by the encoding unit150, and can control the encoded data A-2 to be stored onto the secondbuffer 142 (S320 and S325). As another example, the buffer control unit135 can control the encoded data A-2 to be provided from the encodingunit 150 to the error check code generating unit 145.

In the following phase 920, the buffer control unit 135 in someimplementations can control data B-1, which can be a different formerhalf data than the data A-1, to be stored onto the first storage area144 (S340). Meanwhile, the error check code generating unit 145 cangenerate an error check code and/or error correction code based on theencoded data A-1 and data A-2. The buffer control unit 135 can store theerror check code and/or error correction code generated by the errorcheck code generating unit 145 into the second buffer 142 (S330).

At a timing 805 between the phase 920 and a phase 930, the buffercontrol unit 135 in some implementations stores data B-2 (the data B-1and data B-2 together form one piece of data B), which can be adifferent latter half data than the data A-2, onto the second storagearea 146 (S355). Meanwhile, the buffer control unit 135 in someimplementations controls the data B-1 which is stored on the firststorage area 144 to be encoded by the encoding unit 150, and controlsthe encoded data B-1 to be stored onto the second buffer 142 (S345 andS350). As another example, the buffer control unit 135 can control theencoded data B-1 to be provided from the encoding unit 150 to the errorcheck code generating unit 145.

At the timing 805, before storing the encoded data B-1 onto the secondbuffer 142, the buffer control unit 135 in some implementations controlsthe encoded data A-1 and A-2 and the error correction code and/or errorcheck code which is generated based on the encoded data A-1 and A-2,which may all be stored on the second buffer 142, to be output andwritten onto the magnetic disk 20. In this case, the buffer control unit135 can partition the error check code and/or error correction code intopieces of data and can write the pieces of data into a writing area ofthe magnetic disk 20 at predetermined intervals (S380).

Subsequently, at a timing 810 between the phase 930 and a phase 940, thebuffer control unit 135 in some implementations controls the data B-2which is stored on the second storage area 146 to be encoded by theencoding unit 150, and controls the encoded data B-2 to be stored ontothe second buffer 142 (S360 and S365). The buffer control unit 135 canalso control the encoded data B-2 to be provided from the encoding unit150 to the error check code generating unit 145. As another example, thebuffer control unit 135 can store data C-1, which can be a differentformer half data than the data A-1 and data B-1, onto the first storagearea 144 at the timing 810 (S385).

In the phase 940, the error check code generating unit 145 in someimplementations generates an error check code and/or error correctioncode based on the encoded data B-1 and encoded data B-2. The buffercontrol unit 135 can store the error check code and/or error correctioncode which is generated by the error check code generating unit 145 ontothe second buffer 142 (S370).

In some implementations, at a timing 815 between the phase 940 and aphase 950, the buffer control unit 135 stores data C-2 (the data C-1 anddata C-2 together form one piece of data C), which can be a differentlatter half data than the data A-2 and data B-2, onto the second storagearea 146 (S405). Meanwhile, the buffer control unit 135 can control thedata C-1 which is stored on the first storage area 144 to be encoded bythe encoding unit 150, and can control the encoded data C-1 to be storedonto the second buffer 142 (S390 and S395). As another example, thebuffer control unit 135 can control the encoded data C-1 to be providedfrom the encoding unit 150 to the error check code generating unit 145.

In some implementations, before storing the encoded data C-1 onto thesecond buffer 142, the buffer control unit 135 can control the encodeddata B-1 and B-2 and the error correction code and/or error check codewhich is generated based on the encoded data B-1 and B-2, which are allstored on the second buffer 142, to be output and written into themagnetic disk 20. For example, the buffer control unit 135 can partitionthe error check code and/or error correction code into pieces of dataand write the pieces of data into a writing area of the magnetic disk 20at predetermined intervals (S400).

In some implementations, at a timing 820 between the phase 950 and thenext phase, the buffer control unit 135 controls the data C-2 which isstored on the second storage area 146 to be encoded by the encoding unit150, and can control the encoded data C-2 to be stored onto the secondbuffer 142 (S410). For example, the buffer control unit 135 can controlthe encoded data C-2 to be provided from the encoding unit 150 to theerror check code generating unit 145. Here, in the phase subsequent tothe phase 950, the error check code generating unit 145 can generate anerror check code and/or error correction code based on the encoded dataC-1 and encoded data C-2. The buffer control unit 135 can store theerror check code and/or error correction code generated by the errorcheck code generating unit 145 onto the second buffer 142 (S415).

In some implementations, the magnetic disk controller 10 divides onepiece of data into former half data and latter half data, and encodeseach of the former half data and latter half data. For example, themagnetic disk controller 10 can partition an error check code and/orerror correction code, which can be generated based on the encodedformer half data and encoded latter half data, into pieces of data, andcan store the pieces of data onto the magnetic disk 20 at predeterminedintervals.

FIG. 9 shows, as an example, writing of data into the magnetic disk 20that can be performed by, for example, the magnetic disk controller 10.To begin with, in a phase 900, the buffer control unit 135 can storedata A-1, which is part of data A, onto the first storage area 144 inthe first buffer 141. In a phase 910, the buffer control unit 135 cancontrol the data A-1 stored on the first storage area 144 to be encodedby the encoding unit 150, and can store the encoded data A-1 onto thesecond buffer 142. In some implementations, the buffer control unit 135controls the encoded data A-1 to be provided to the error check codegenerating unit 145. The buffer control unit 135 can store data A-2,which is the remaining portion of the data A, onto the second storagearea 146 in the first buffer 141.

Subsequently in a phase 920, the buffer control unit 135 in someimplementations stores data B-1, which is part of data B, onto the firststorage area 144. The buffer control unit 135 can control the data A-2stored on the second storage area 146 to be encoded by the encoding unit150, and can store the encoded data A-2 onto the second buffer 142. Thebuffer control unit 135 can control the encoded data A-2 to be providedto the error check code generating unit 145. The error check codegenerating unit 145 can generate an error check code and/or errorcorrection code for the data A based on the encoded data A-1 and encodeddata A-2. The buffer control unit 135 can store the error check codeand/or error correction code which is generated by the error check codegenerating unit 145 onto the second buffer 142.

In a phase 930, the buffer control unit 135 in some implementationsstores data B-2, which is the remaining portion of the data B, onto thesecond storage area 146. In some implementations, the buffer controlunit 135 controls the data B-1 which is stored on the first storage area144 to be encoded by the encoding unit 150, and can store the encodeddata B-1 onto the third buffer 143. The buffer control unit 135 cancontrol the encoded data B-1 to be provided to the error check codegenerating unit 145. In the phase 930, the buffer control unit 135 insome implementations provides the encoded data A-1, which is stored onthe second buffer 142, to the writing control unit 110. The writingcontrol unit 110 can write the encoded data A-1 into the magnetic disk20 (S932).

In the following phase 940, the buffer control unit 135 in someimplementations stores data C-1, which is part of data C, onto the firststorage area 144. The buffer control unit 135 can provide the encodeddata A-2, which is stored on the second buffer 142, to the writingcontrol unit 110. The writing control unit 110 can write the encodeddata A-2 into the magnetic disk 20 (S942). In some implementations, thewriting control unit 110 writes the error check code and/or errorcorrection code for the data A, which is stored on the second buffer142, into the magnetic disk 20.

In some implementations, the buffer control unit 135 controls the dataB-2 which is stored on the second storage area 146 to be encoded by theencoding unit 150, and can store the encoded data B-2 onto the thirdbuffer 143. The buffer control unit 135 can provide the encoded data B-2to the error check code generating unit 145. The error check codegenerating unit 145 can generate an error check code and/or errorcorrection code for the data B, based on the encoded data B-1 andencoded data B-2. The buffer control unit 135 can store the error checkcode and/or error correction code, which is generated by the error checkcode generating unit 145, onto the third buffer 143.

In a phase 950, the buffer control unit 135 in some implementationsstores data C-2, which is the remaining portion of the data C, onto thesecond storage area 146. The buffer control unit 135 can control thedata C-1 which is stored on the first storage area 144 to be encoded bythe encoding unit 150, and can store the encoded data C-1 onto thesecond buffer 142. The buffer control unit 135 can provide the encodeddata C-1 to the error check code generating unit 145. In the phase 950,the buffer control unit 135 in some implementations provides the encodeddata B-1 which is stored on the third buffer 143 to the writing controlunit 110. The writing control unit 110 can write the encoded data B-1into the magnetic disk 20 (S952).

Subsequently in the following phase 960, the buffer control unit 135 insome implementations stores data D-1, which is part of data D, onto thefirst storage area 144. The buffer control unit 135 can provide theencoded data B-2 which is stored on the third buffer 143 to the writingcontrol unit 110. The writing control unit 110 can write the encodeddata B-2 into the magnetic disk 20 (S962). In this case, the writingcontrol unit 110 can write the error check code and/or error correctioncode for the data B, which is stored on the third buffer 143, into themagnetic disk 20.

In some implementations, the buffer control unit 135 controls the dataC-2 which is stored on the second storage area 146 to be encoded by theencoding unit 150, and can store the encoded data C-2 onto the secondbuffer 142. The buffer control unit 135 can provide the encoded data C-2to the error check code generating unit 145. The error check codegenerating unit 145 can generate an error check code and/or errorcorrection code for the data C, based on the encoded data C-1 andencoded data C-2. The buffer control unit 135 can store the error checkcode and/or error correction code, which is generated by the error checkcode generating unit 145, onto the second buffer 142.

While the embodiments of the present invention have been described, thetechnical scope of the invention is not limited to the above describedembodiments. It is apparent to persons skilled in the art that variousalternations and improvements can be added to the above-describedembodiments. It is also apparent from the scope of the claims that theembodiments added with such alternations or improvements can be includedin the technical scope of the invention.

For example, some embodiments of the present invention can write dataand an error check code into a magnetic disk immediately aftergenerating the error check code based on the data.

A number of embodiments have been described. Nevertheless, it will beunderstood that various modifications may be made without departing fromthe spirit and scope of this disclosure. Accordingly, other embodimentsare within the scope of the following claims.

1. A magnetic disk controller comprising: an index detecting unit thatdetects an index of a magnetic disk; an error check code generating unitthat, after the index detecting unit detects the index, generates afirst error check code for a first write data based on the first writedata and on a first physical address of a first sector subsequent to thedetected index; and a writing control unit that causes the first errorcheck code, the first write data and the first physical address to bewritten into a second sector subsequent to the first sector.
 2. Themagnetic disk controller according to claim 1, wherein: the first sectoris adjacent to the detected index; and the second sector is adjacent tothe first sector on a side opposite from the detected index.
 3. Themagnetic disk controller according to claim 1, further comprising: anaddress generating unit that sequentially generates a physical addressof a sector in accordance with an elapsed time from when the indexdetecting unit detects the index; wherein the first physical address ofthe first sector is generated by the address generating unit.
 4. Themagnetic disk controller according to claim 3, wherein the error checkcode generating unit further generates a second error check code forsecond write data based on the second write data and on a secondphysical address of the second sector which is generated by the addressgenerating unit; and the writing control unit further causes the seconderror check code, the second write data and the second physical addressto be written into a third sector subsequent to the second sector. 5.The magnetic disk controller according to claim 4, wherein the thirdsector is adjacent to the second sector on a side opposite from thefirst sector.
 6. The magnetic disk controller according to claim 1,further comprising: an address obtaining unit to obtain a physicaladdress representing a sector on which read data is stored; an addressadding unit to add a predetermined value to the physical addressobtained by the address obtaining unit; and a reading control unit tocause data to be read from a sector represented by a physical addressgenerated as a result of the addition performed by the address addingunit.
 7. The magnetic disk controller according to claim 6, wherein thepredetermined value is one.
 8. A method of controlling writing of datainto a magnetic disk, comprising: detecting an index of a magnetic disk;generating, after the index is detected, a first error check code forfirst write data based on first write data and on a first physicaladdress of a first sector subsequent to the detected index; and causingthe generated first error check code, the first write data and the firstphysical address to be written into a second sector subsequent to thefirst sector.
 9. The method according to claim 8, wherein: the firstsector is adjacent to the detected index; and the second sector isadjacent to the first sector on a side opposite from the detected index.10. The method according to claim 8, further comprising: sequentiallygenerating the first physical address of the first sector in accordancewith an elapsed time from when the index is detected.
 11. The methodaccording to claim 10, further comprising: generating a second physicaladdress of the second sector; generating a second error check code forsecond write data based on the second write data and on the secondphysical address of the second sector; and causing the second errorcheck code, the second write data and the second physical address to bewritten into a third sector subsequent to the second sector.
 12. Themethod according to claim 11, wherein the third sector is adjacent tothe second sector on a side opposite from the first sector.
 13. Themethod according to claim 8, further comprising: obtaining a physicaladdress representing a sector on which read data is stored; adding apredetermined value to the obtained physical address to form a newphysical address; and causing data to be read from a sector representedby the new physical address.
 14. The method according to claim 13,wherein the predetermined value is one.
 15. A magnetic disk controllercomprising: means for detecting an index of a magnetic disk; means forgenerating, after the index is detected, a first error check code forfirst write data based on the first write data and on a first physicaladdress of a first sector subsequent to the detected index; and meansfor causing the generated first error check code, the first write dataand the first physical address to be written into a second sectorsubsequent to the first sector.
 16. A method comprising: determining afirst physical address of a magnetic disk to which first data is to bewritten; generating a first error check code based on the first data andthe first physical address; and writing the first physical address, thefirst error check code and the first data to the magnetic diskimmediately after generating the first error check code.
 17. The methodaccording to claim 16, wherein: writing the first physical address, thefirst error check code and the first data is performed prior to a headof the magnetic disk re-aligning with a previous position on themagnetic disk.
 18. The method according to claim 17, wherein: theprevious position is where the head was located when the first errorcheck code was generated.
 19. The method according to claim 16, whereinthe first physical address is associated with a first sector on themagnetic disk, and wherein the first physical address, the first errorcheck code and the first data are written to a second sector on themagnetic disk associated with a second physical address, the methodfurther comprising: obtaining the first physical address as a locationfor reading the first data; converting the first physical address to thesecond physical address; and reading the first data from the secondsector using the second physical address.
 20. The method according toclaim 19, wherein the conversion comprises adding a predetermined valueto the first physical address.